package top.mineidea.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/*
 * Spring两步骤
 * 1. 找对象
 * 2. 放进Spring中待用
 * 3. 如果是Springboot就分析源码
 * xxxAutoConfiguration xxxProperties
 * */

@Configuration
public class ElasticSearchClientConfig {
    @Bean
    public RestHighLevelClient restHighLevelClient() {
        RestHighLevelClient restHighLevelClient =
                new RestHighLevelClient(
                        RestClient.builder(new HttpHost("localhost", 9200, "http")));
        return restHighLevelClient;
    }
}
